<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/system/error_code.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/system</a> - error_code.hpp<span style="font-size: 80%;"> (source / <a href="error_code.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">3</td>
            <td class="headerCovTableEntry">5</td>
            <td class="headerCovTableEntryLo">60.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntryHi">-</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : //  boost/system/error_code.hpp  ---------------------------------------------//</a>
<span class="lineNum">       2 </span>            : 
<span class="lineNum">       3 </span>            : //  Copyright Beman Dawes 2006, 2007
<span class="lineNum">       4 </span>            : //  Copyright Christoper Kohlhoff 2007
<span class="lineNum">       5 </span>            : 
<span class="lineNum">       6 </span>            : //  Distributed under the Boost Software License, Version 1.0. (See accompanying
<span class="lineNum">       7 </span>            : //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       8 </span>            : 
<span class="lineNum">       9 </span>            : //  See library home page at http://www.boost.org/libs/system
<span class="lineNum">      10 </span>            : 
<span class="lineNum">      11 </span>            : #ifndef BOOST_ERROR_CODE_HPP
<span class="lineNum">      12 </span>            : #define BOOST_ERROR_CODE_HPP
<span class="lineNum">      13 </span>            : 
<span class="lineNum">      14 </span>            : #include &lt;boost/system/config.hpp&gt;
<span class="lineNum">      15 </span>            : #include &lt;boost/cstdint.hpp&gt;
<span class="lineNum">      16 </span>            : #include &lt;boost/assert.hpp&gt;
<span class="lineNum">      17 </span>            : #include &lt;boost/noncopyable.hpp&gt;
<span class="lineNum">      18 </span>            : #include &lt;boost/utility/enable_if.hpp&gt;
<span class="lineNum">      19 </span>            : #include &lt;ostream&gt;
<span class="lineNum">      20 </span>            : #include &lt;string&gt;
<span class="lineNum">      21 </span>            : #include &lt;stdexcept&gt;
<span class="lineNum">      22 </span>            : #include &lt;functional&gt;
<span class="lineNum">      23 </span>            : 
<span class="lineNum">      24 </span>            : // TODO: undef these macros if not already defined
<span class="lineNum">      25 </span>            : #include &lt;boost/cerrno.hpp&gt;
<span class="lineNum">      26 </span>            : 
<span class="lineNum">      27 </span>            : #if !defined(BOOST_POSIX_API) &amp;&amp; !defined(BOOST_WINDOWS_API)
<span class="lineNum">      28 </span>            : #  error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
<span class="lineNum">      29 </span>            : #endif
<span class="lineNum">      30 </span>            : 
<span class="lineNum">      31 </span>            : #include &lt;boost/config/abi_prefix.hpp&gt; // must be the last #include
<span class="lineNum">      32 </span>            : 
<span class="lineNum">      33 </span>            : #ifndef BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">      34 </span>            : #define BOOST_SYSTEM_NOEXCEPT BOOST_NOEXCEPT
<span class="lineNum">      35 </span>            : #endif
<span class="lineNum">      36 </span>            : 
<span class="lineNum">      37 </span>            : namespace boost
<span class="lineNum">      38 </span>            : {
<span class="lineNum">      39 </span>            :   namespace system
<span class="lineNum">      40 </span>            :   {
<span class="lineNum">      41 </span>            : 
<span class="lineNum">      42 </span>            :     class error_code;
<span class="lineNum">      43 </span>            :     class error_condition;
<span class="lineNum">      44 </span>            : 
<span class="lineNum">      45 </span>            :     //  &quot;Concept&quot; helpers  ---------------------------------------------------//
<span class="lineNum">      46 </span>            : 
<span class="lineNum">      47 </span>            :     template&lt; class T &gt;
<span class="lineNum">      48 </span>            :     struct is_error_code_enum { static const bool value = false; };
<span class="lineNum">      49 </span>            : 
<span class="lineNum">      50 </span>            :     template&lt; class T &gt;
<span class="lineNum">      51 </span>            :     struct is_error_condition_enum { static const bool value = false; };
<span class="lineNum">      52 </span>            : 
<span class="lineNum">      53 </span>            :     //  generic error_conditions  --------------------------------------------//
<span class="lineNum">      54 </span>            : 
<span class="lineNum">      55 </span>            :     namespace errc
<span class="lineNum">      56 </span>            :     {
<span class="lineNum">      57 </span>            :       enum errc_t
<span class="lineNum">      58 </span>            :       {
<span class="lineNum">      59 </span>            :         success = 0,
<span class="lineNum">      60 </span>            :         address_family_not_supported = EAFNOSUPPORT,
<span class="lineNum">      61 </span>            :         address_in_use = EADDRINUSE,
<span class="lineNum">      62 </span>            :         address_not_available = EADDRNOTAVAIL,
<span class="lineNum">      63 </span>            :         already_connected = EISCONN,
<span class="lineNum">      64 </span>            :         argument_list_too_long = E2BIG,
<span class="lineNum">      65 </span>            :         argument_out_of_domain = EDOM,
<span class="lineNum">      66 </span>            :         bad_address = EFAULT,
<span class="lineNum">      67 </span>            :         bad_file_descriptor = EBADF,
<span class="lineNum">      68 </span>            :         bad_message = EBADMSG,
<span class="lineNum">      69 </span>            :         broken_pipe = EPIPE,
<span class="lineNum">      70 </span>            :         connection_aborted = ECONNABORTED,
<span class="lineNum">      71 </span>            :         connection_already_in_progress = EALREADY,
<span class="lineNum">      72 </span>            :         connection_refused = ECONNREFUSED,
<span class="lineNum">      73 </span>            :         connection_reset = ECONNRESET,
<span class="lineNum">      74 </span>            :         cross_device_link = EXDEV,
<span class="lineNum">      75 </span>            :         destination_address_required = EDESTADDRREQ,
<span class="lineNum">      76 </span>            :         device_or_resource_busy = EBUSY,
<span class="lineNum">      77 </span>            :         directory_not_empty = ENOTEMPTY,
<span class="lineNum">      78 </span>            :         executable_format_error = ENOEXEC,
<span class="lineNum">      79 </span>            :         file_exists = EEXIST,
<span class="lineNum">      80 </span>            :         file_too_large = EFBIG,
<span class="lineNum">      81 </span>            :         filename_too_long = ENAMETOOLONG,
<span class="lineNum">      82 </span>            :         function_not_supported = ENOSYS,
<span class="lineNum">      83 </span>            :         host_unreachable = EHOSTUNREACH,
<span class="lineNum">      84 </span>            :         identifier_removed = EIDRM,
<span class="lineNum">      85 </span>            :         illegal_byte_sequence = EILSEQ,
<span class="lineNum">      86 </span>            :         inappropriate_io_control_operation = ENOTTY,
<span class="lineNum">      87 </span>            :         interrupted = EINTR,
<span class="lineNum">      88 </span>            :         invalid_argument = EINVAL,
<span class="lineNum">      89 </span>            :         invalid_seek = ESPIPE,
<span class="lineNum">      90 </span>            :         io_error = EIO,
<span class="lineNum">      91 </span>            :         is_a_directory = EISDIR,
<span class="lineNum">      92 </span>            :         message_size = EMSGSIZE,
<span class="lineNum">      93 </span>            :         network_down = ENETDOWN,
<span class="lineNum">      94 </span>            :         network_reset = ENETRESET,
<span class="lineNum">      95 </span>            :         network_unreachable = ENETUNREACH,
<span class="lineNum">      96 </span>            :         no_buffer_space = ENOBUFS,
<span class="lineNum">      97 </span>            :         no_child_process = ECHILD,
<span class="lineNum">      98 </span>            :         no_link = ENOLINK,
<span class="lineNum">      99 </span>            :         no_lock_available = ENOLCK,
<span class="lineNum">     100 </span>            :         no_message_available = ENODATA,
<span class="lineNum">     101 </span>            :         no_message = ENOMSG,
<span class="lineNum">     102 </span>            :         no_protocol_option = ENOPROTOOPT,
<span class="lineNum">     103 </span>            :         no_space_on_device = ENOSPC,
<span class="lineNum">     104 </span>            :         no_stream_resources = ENOSR,
<span class="lineNum">     105 </span>            :         no_such_device_or_address = ENXIO,
<span class="lineNum">     106 </span>            :         no_such_device = ENODEV,
<span class="lineNum">     107 </span>            :         no_such_file_or_directory = ENOENT,
<span class="lineNum">     108 </span>            :         no_such_process = ESRCH,
<span class="lineNum">     109 </span>            :         not_a_directory = ENOTDIR,
<span class="lineNum">     110 </span>            :         not_a_socket = ENOTSOCK,
<span class="lineNum">     111 </span>            :         not_a_stream = ENOSTR,
<span class="lineNum">     112 </span>            :         not_connected = ENOTCONN,
<span class="lineNum">     113 </span>            :         not_enough_memory = ENOMEM,
<span class="lineNum">     114 </span>            :         not_supported = ENOTSUP,
<span class="lineNum">     115 </span>            :         operation_canceled = ECANCELED,
<span class="lineNum">     116 </span>            :         operation_in_progress = EINPROGRESS,
<span class="lineNum">     117 </span>            :         operation_not_permitted = EPERM,
<span class="lineNum">     118 </span>            :         operation_not_supported = EOPNOTSUPP,
<span class="lineNum">     119 </span>            :         operation_would_block = EWOULDBLOCK,
<span class="lineNum">     120 </span>            :         owner_dead = EOWNERDEAD,
<span class="lineNum">     121 </span>            :         permission_denied = EACCES,
<span class="lineNum">     122 </span>            :         protocol_error = EPROTO,
<span class="lineNum">     123 </span>            :         protocol_not_supported = EPROTONOSUPPORT,
<span class="lineNum">     124 </span>            :         read_only_file_system = EROFS,
<span class="lineNum">     125 </span>            :         resource_deadlock_would_occur = EDEADLK,
<span class="lineNum">     126 </span>            :         resource_unavailable_try_again = EAGAIN,
<span class="lineNum">     127 </span>            :         result_out_of_range = ERANGE,
<span class="lineNum">     128 </span>            :         state_not_recoverable = ENOTRECOVERABLE,
<span class="lineNum">     129 </span>            :         stream_timeout = ETIME,
<span class="lineNum">     130 </span>            :         text_file_busy = ETXTBSY,
<span class="lineNum">     131 </span>            :         timed_out = ETIMEDOUT,
<span class="lineNum">     132 </span>            :         too_many_files_open_in_system = ENFILE,
<span class="lineNum">     133 </span>            :         too_many_files_open = EMFILE,
<span class="lineNum">     134 </span>            :         too_many_links = EMLINK,
<span class="lineNum">     135 </span>            :         too_many_symbolic_link_levels = ELOOP,
<span class="lineNum">     136 </span>            :         value_too_large = EOVERFLOW,
<span class="lineNum">     137 </span>            :         wrong_protocol_type = EPROTOTYPE
<span class="lineNum">     138 </span>            :       };
<span class="lineNum">     139 </span>            : 
<span class="lineNum">     140 </span>            :     } // namespace errc
<span class="lineNum">     141 </span>            : 
<span class="lineNum">     142 </span>            : # ifndef BOOST_SYSTEM_NO_DEPRECATED
<span class="lineNum">     143 </span>            :     namespace posix = errc;
<span class="lineNum">     144 </span>            :     namespace posix_error = errc;
<span class="lineNum">     145 </span>            : # endif
<span class="lineNum">     146 </span>            : 
<span class="lineNum">     147 </span>            :     template&lt;&gt; struct is_error_condition_enum&lt;errc::errc_t&gt;
<span class="lineNum">     148 </span>            :       { static const bool value = true; };
<span class="lineNum">     149 </span>            : 
<span class="lineNum">     150 </span>            : 
<span class="lineNum">     151 </span>            :     //  ----------------------------------------------------------------------//
<span class="lineNum">     152 </span>            : 
<span class="lineNum">     153 </span>            :     //  Operating system specific interfaces  --------------------------------//
<span class="lineNum">     154 </span>            : 
<span class="lineNum">     155 </span>            : 
<span class="lineNum">     156 </span>            :     //  The interface is divided into general and system-specific portions to
<span class="lineNum">     157 </span>            :     //  meet these requirements:
<span class="lineNum">     158 </span>            :     //
<span class="lineNum">     159 </span>            :     //  * Code calling an operating system API can create an error_code with
<span class="lineNum">     160 </span>            :     //    a single category (system_category), even for POSIX-like operating
<span class="lineNum">     161 </span>            :     //    systems that return some POSIX errno values and some native errno
<span class="lineNum">     162 </span>            :     //    values. This code should not have to pay the cost of distinguishing
<span class="lineNum">     163 </span>            :     //    between categories, since it is not yet known if that is needed.
<span class="lineNum">     164 </span>            :     //
<span class="lineNum">     165 </span>            :     //  * Users wishing to write system-specific code should be given enums for
<span class="lineNum">     166 </span>            :     //    at least the common error cases.
<span class="lineNum">     167 </span>            :     //
<span class="lineNum">     168 </span>            :     //  * System specific code should fail at compile time if moved to another
<span class="lineNum">     169 </span>            :     //    operating system.
<span class="lineNum">     170 </span>            : 
<span class="lineNum">     171 </span>            :     //  The system specific portions of the interface are located in headers
<span class="lineNum">     172 </span>            :     //  with names reflecting the operating system. For example,
<span class="lineNum">     173 </span>            :     //
<span class="lineNum">     174 </span>            :     //       &lt;boost/system/cygwin_error.hpp&gt;
<span class="lineNum">     175 </span>            :     //       &lt;boost/system/linux_error.hpp&gt;
<span class="lineNum">     176 </span>            :     //       &lt;boost/system/windows_error.hpp&gt;
<span class="lineNum">     177 </span>            :     //
<span class="lineNum">     178 </span>            :     //  These headers are effectively empty for compiles on operating systems
<span class="lineNum">     179 </span>            :     //  where they are not applicable.
<span class="lineNum">     180 </span>            : 
<span class="lineNum">     181 </span>            :     //  ----------------------------------------------------------------------//
<span class="lineNum">     182 </span>            : 
<span class="lineNum">     183 </span>            :     //  class error_category  ------------------------------------------------//
<span class="lineNum">     184 </span>            : 
<span class="lineNum">     185 </span>            :     class error_category : public noncopyable
<span class="lineNum">     186 </span>            :     {
<span class="lineNum">     187 </span>            :     public:
<span class="lineNum">     188 </span>            :       virtual ~error_category(){}
<span class="lineNum">     189 </span>            : 
<span class="lineNum">     190 </span>            :       virtual const char *     name() const BOOST_SYSTEM_NOEXCEPT = 0;
<span class="lineNum">     191 </span>            :       virtual std::string      message( int ev ) const = 0;
<span class="lineNum">     192 </span>            :       inline virtual error_condition  default_error_condition( int ev ) const  BOOST_SYSTEM_NOEXCEPT;
<span class="lineNum">     193 </span>            :       inline virtual bool             equivalent( int code,
<span class="lineNum">     194 </span>            :                                            const error_condition &amp; condition ) const  BOOST_SYSTEM_NOEXCEPT;
<span class="lineNum">     195 </span>            :       inline virtual bool             equivalent( const error_code &amp; code,
<span class="lineNum">     196 </span>            :                                            int condition ) const  BOOST_SYSTEM_NOEXCEPT;
<span class="lineNum">     197 </span>            : 
<span class="lineNum">     198 </span>            :       bool operator==(const error_category &amp; rhs) const BOOST_SYSTEM_NOEXCEPT { return this == &amp;rhs; }
<span class="lineNum">     199 </span>            :       bool operator!=(const error_category &amp; rhs) const BOOST_SYSTEM_NOEXCEPT { return this != &amp;rhs; }
<span class="lineNum">     200 </span>            :       bool operator&lt;( const error_category &amp; rhs ) const BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     201 </span>            :       {
<span class="lineNum">     202 </span>            :         return std::less&lt;const error_category*&gt;()( this, &amp;rhs );
<span class="lineNum">     203 </span>            :       }
<span class="lineNum">     204 </span>            :     };
<span class="lineNum">     205 </span>            : 
<span class="lineNum">     206 </span>            :     //  predefined error categories  -----------------------------------------//
<span class="lineNum">     207 </span>            : 
<span class="lineNum">     208 </span>            : # ifdef BOOST_ERROR_CODE_HEADER_ONLY
<span class="lineNum">     209 </span>            :     inline const error_category &amp;  system_category() BOOST_SYSTEM_NOEXCEPT;
<span class="lineNum">     210 </span>            :     inline const error_category &amp;  generic_category() BOOST_SYSTEM_NOEXCEPT;
<span class="lineNum">     211 </span>            : #else
<span class="lineNum">     212 </span>            :     BOOST_SYSTEM_DECL const error_category &amp;  system_category() BOOST_SYSTEM_NOEXCEPT;
<span class="lineNum">     213 </span>            :     BOOST_SYSTEM_DECL const error_category &amp;  generic_category() BOOST_SYSTEM_NOEXCEPT;
<span class="lineNum">     214 </span>            : #endif
<span class="lineNum">     215 </span>            :     //  deprecated synonyms --------------------------------------------------//
<span class="lineNum">     216 </span>            : 
<span class="lineNum">     217 </span>            : # ifndef BOOST_SYSTEM_NO_DEPRECATED
<span class="lineNum">     218 </span>            :     inline const error_category &amp;  get_system_category() { return system_category(); }
<span class="lineNum">     219 </span>            :     inline const error_category &amp;  get_generic_category() { return generic_category(); }
<span class="lineNum">     220 </span>            :     inline const error_category &amp;  get_posix_category() { return generic_category(); }
<span class="lineNum">     221 </span><span class="lineCov">         13 :     static const error_category &amp;  posix_category = generic_category();</span>
<span class="lineNum">     222 </span><span class="lineCov">         13 :     static const error_category &amp;  errno_ecat     = generic_category();</span>
<span class="lineNum">     223 </span><span class="lineCov">         13 :     static const error_category &amp;  native_ecat    = system_category();</span>
<span class="lineNum">     224 </span>            : # endif
<span class="lineNum">     225 </span>            : 
<span class="lineNum">     226 </span>            :     //  class error_condition  -----------------------------------------------//
<span class="lineNum">     227 </span>            : 
<span class="lineNum">     228 </span>            :     //  error_conditions are portable, error_codes are system or library specific
<span class="lineNum">     229 </span>            : 
<span class="lineNum">     230 </span>            :     class error_condition
<span class="lineNum">     231 </span>            :     {
<span class="lineNum">     232 </span>            :     public:
<span class="lineNum">     233 </span>            : 
<span class="lineNum">     234 </span>            :       // constructors:
<span class="lineNum">     235 </span>            :       error_condition() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&amp;generic_category()) {}
<span class="lineNum">     236 </span>            :       error_condition( int val, const error_category &amp; cat ) BOOST_SYSTEM_NOEXCEPT : m_val(val), m_cat(&amp;cat) {}
<span class="lineNum">     237 </span>            : 
<span class="lineNum">     238 </span>            :       template &lt;class ErrorConditionEnum&gt;
<span class="lineNum">     239 </span>            :         error_condition(ErrorConditionEnum e,
<span class="lineNum">     240 </span>            :           typename boost::enable_if&lt;is_error_condition_enum&lt;ErrorConditionEnum&gt; &gt;::type* = 0) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     241 </span>            :       {
<span class="lineNum">     242 </span>            :         *this = make_error_condition(e);
<span class="lineNum">     243 </span>            :       }
<span class="lineNum">     244 </span>            : 
<span class="lineNum">     245 </span>            :       // modifiers:
<span class="lineNum">     246 </span>            : 
<span class="lineNum">     247 </span>            :       void assign( int val, const error_category &amp; cat ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     248 </span>            :       {
<span class="lineNum">     249 </span>            :         m_val = val;
<span class="lineNum">     250 </span>            :         m_cat = &amp;cat;
<span class="lineNum">     251 </span>            :       }
<span class="lineNum">     252 </span>            : 
<span class="lineNum">     253 </span>            :       template&lt;typename ErrorConditionEnum&gt;
<span class="lineNum">     254 </span>            :         typename boost::enable_if&lt;is_error_condition_enum&lt;ErrorConditionEnum&gt;, error_condition&gt;::type &amp;
<span class="lineNum">     255 </span>            :           operator=( ErrorConditionEnum val ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     256 </span>            :       {
<span class="lineNum">     257 </span>            :         *this = make_error_condition(val);
<span class="lineNum">     258 </span>            :         return *this;
<span class="lineNum">     259 </span>            :       }
<span class="lineNum">     260 </span>            : 
<span class="lineNum">     261 </span>            :       void clear() BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     262 </span>            :       {
<span class="lineNum">     263 </span>            :         m_val = 0;
<span class="lineNum">     264 </span>            :         m_cat = &amp;generic_category();
<span class="lineNum">     265 </span>            :       }
<span class="lineNum">     266 </span>            : 
<span class="lineNum">     267 </span>            :       // observers:
<span class="lineNum">     268 </span>            :       int                     value() const BOOST_SYSTEM_NOEXCEPT    { return m_val; }
<span class="lineNum">     269 </span>            :       const error_category &amp;  category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
<span class="lineNum">     270 </span>            :       std::string             message() const  { return m_cat-&gt;message(value()); }
<span class="lineNum">     271 </span>            : 
<span class="lineNum">     272 </span>            :       typedef void (*unspecified_bool_type)();
<span class="lineNum">     273 </span>            :       static void unspecified_bool_true() {}
<span class="lineNum">     274 </span>            : 
<span class="lineNum">     275 </span>            :       operator unspecified_bool_type() const BOOST_SYSTEM_NOEXCEPT  // true if error
<span class="lineNum">     276 </span>            :       {
<span class="lineNum">     277 </span>            :         return m_val == 0 ? 0 : unspecified_bool_true;
<span class="lineNum">     278 </span>            :       }
<span class="lineNum">     279 </span>            : 
<span class="lineNum">     280 </span>            :       bool operator!() const BOOST_SYSTEM_NOEXCEPT  // true if no error
<span class="lineNum">     281 </span>            :       {
<span class="lineNum">     282 </span>            :         return m_val == 0;
<span class="lineNum">     283 </span>            :       }
<span class="lineNum">     284 </span>            : 
<span class="lineNum">     285 </span>            :       // relationals:
<span class="lineNum">     286 </span>            :       //  the more symmetrical non-member syntax allows enum
<span class="lineNum">     287 </span>            :       //  conversions work for both rhs and lhs.
<span class="lineNum">     288 </span>            :       inline friend bool operator==( const error_condition &amp; lhs,
<span class="lineNum">     289 </span>            :                                      const error_condition &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     290 </span>            :       {
<span class="lineNum">     291 </span>            :         return lhs.m_cat == rhs.m_cat &amp;&amp; lhs.m_val == rhs.m_val;
<span class="lineNum">     292 </span>            :       }
<span class="lineNum">     293 </span>            : 
<span class="lineNum">     294 </span>            :       inline friend bool operator&lt;( const error_condition &amp; lhs,
<span class="lineNum">     295 </span>            :                                     const error_condition &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     296 </span>            :         //  the more symmetrical non-member syntax allows enum
<span class="lineNum">     297 </span>            :         //  conversions work for both rhs and lhs.
<span class="lineNum">     298 </span>            :       {
<span class="lineNum">     299 </span>            :         return lhs.m_cat &lt; rhs.m_cat
<span class="lineNum">     300 </span>            :           || (lhs.m_cat == rhs.m_cat &amp;&amp; lhs.m_val &lt; rhs.m_val);
<span class="lineNum">     301 </span>            :       }
<span class="lineNum">     302 </span>            : 
<span class="lineNum">     303 </span>            :     private:
<span class="lineNum">     304 </span>            :       int                     m_val;
<span class="lineNum">     305 </span>            :       const error_category *  m_cat;
<span class="lineNum">     306 </span>            : 
<span class="lineNum">     307 </span>            :     };
<span class="lineNum">     308 </span>            : 
<span class="lineNum">     309 </span>            :     //  class error_code  ----------------------------------------------------//
<span class="lineNum">     310 </span>            : 
<span class="lineNum">     311 </span>            :     //  We want error_code to be a value type that can be copied without slicing
<span class="lineNum">     312 </span>            :     //  and without requiring heap allocation, but we also want it to have
<span class="lineNum">     313 </span>            :     //  polymorphic behavior based on the error category. This is achieved by
<span class="lineNum">     314 </span>            :     //  abstract base class error_category supplying the polymorphic behavior,
<span class="lineNum">     315 </span>            :     //  and error_code containing a pointer to an object of a type derived
<span class="lineNum">     316 </span>            :     //  from error_category.
<span class="lineNum">     317 </span>            :     class error_code
<span class="lineNum">     318 </span>            :     {
<span class="lineNum">     319 </span>            :     public:
<span class="lineNum">     320 </span>            : 
<span class="lineNum">     321 </span>            :       // constructors:
<span class="lineNum">     322 </span>            :       error_code() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&amp;system_category()) {}
<span class="lineNum">     323 </span><span class="lineNoCov">          0 :       error_code( int val, const error_category &amp; cat ) BOOST_SYSTEM_NOEXCEPT : m_val(val), m_cat(&amp;cat) {}</span>
<span class="lineNum">     324 </span>            : 
<span class="lineNum">     325 </span>            :       template &lt;class ErrorCodeEnum&gt;
<span class="lineNum">     326 </span>            :         error_code(ErrorCodeEnum e,
<span class="lineNum">     327 </span>            :           typename boost::enable_if&lt;is_error_code_enum&lt;ErrorCodeEnum&gt; &gt;::type* = 0) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     328 </span>            :       {
<span class="lineNum">     329 </span>            :         *this = make_error_code(e);
<span class="lineNum">     330 </span>            :       }
<span class="lineNum">     331 </span>            : 
<span class="lineNum">     332 </span>            :       // modifiers:
<span class="lineNum">     333 </span>            :       void assign( int val, const error_category &amp; cat ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     334 </span>            :       {
<span class="lineNum">     335 </span>            :         m_val = val;
<span class="lineNum">     336 </span>            :         m_cat = &amp;cat;
<span class="lineNum">     337 </span>            :       }
<span class="lineNum">     338 </span>            : 
<span class="lineNum">     339 </span>            :       template&lt;typename ErrorCodeEnum&gt;
<span class="lineNum">     340 </span>            :         typename boost::enable_if&lt;is_error_code_enum&lt;ErrorCodeEnum&gt;, error_code&gt;::type &amp;
<span class="lineNum">     341 </span>            :           operator=( ErrorCodeEnum val ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     342 </span>            :       {
<span class="lineNum">     343 </span>            :         *this = make_error_code(val);
<span class="lineNum">     344 </span>            :         return *this;
<span class="lineNum">     345 </span>            :       }
<span class="lineNum">     346 </span>            : 
<span class="lineNum">     347 </span>            :       void clear() BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     348 </span>            :       {
<span class="lineNum">     349 </span>            :         m_val = 0;
<span class="lineNum">     350 </span>            :         m_cat = &amp;system_category();
<span class="lineNum">     351 </span>            :       }
<span class="lineNum">     352 </span>            : 
<span class="lineNum">     353 </span>            :       // observers:
<span class="lineNum">     354 </span>            :       int                     value() const  BOOST_SYSTEM_NOEXCEPT   { return m_val; }
<span class="lineNum">     355 </span>            :       const error_category &amp;  category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
<span class="lineNum">     356 </span>            :       error_condition         default_error_condition() const BOOST_SYSTEM_NOEXCEPT  { return m_cat-&gt;default_error_condition(value()); }
<span class="lineNum">     357 </span><span class="lineNoCov">          0 :       std::string             message() const  { return m_cat-&gt;message(value()); }</span>
<span class="lineNum">     358 </span>            : 
<span class="lineNum">     359 </span>            :       typedef void (*unspecified_bool_type)();
<span class="lineNum">     360 </span>            :       static void unspecified_bool_true() {}
<span class="lineNum">     361 </span>            : 
<span class="lineNum">     362 </span>            :       operator unspecified_bool_type() const  BOOST_SYSTEM_NOEXCEPT // true if error
<span class="lineNum">     363 </span>            :       {
<span class="lineNum">     364 </span>            :         return m_val == 0 ? 0 : unspecified_bool_true;
<span class="lineNum">     365 </span>            :       }
<span class="lineNum">     366 </span>            : 
<span class="lineNum">     367 </span>            :       bool operator!() const  BOOST_SYSTEM_NOEXCEPT // true if no error
<span class="lineNum">     368 </span>            :       {
<span class="lineNum">     369 </span>            :         return m_val == 0;
<span class="lineNum">     370 </span>            :       }
<span class="lineNum">     371 </span>            : 
<span class="lineNum">     372 </span>            :       // relationals:
<span class="lineNum">     373 </span>            :       inline friend bool operator==( const error_code &amp; lhs,
<span class="lineNum">     374 </span>            :                                      const error_code &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     375 </span>            :         //  the more symmetrical non-member syntax allows enum
<span class="lineNum">     376 </span>            :         //  conversions work for both rhs and lhs.
<span class="lineNum">     377 </span>            :       {
<span class="lineNum">     378 </span>            :         return lhs.m_cat == rhs.m_cat &amp;&amp; lhs.m_val == rhs.m_val;
<span class="lineNum">     379 </span>            :       }
<span class="lineNum">     380 </span>            : 
<span class="lineNum">     381 </span>            :       inline friend bool operator&lt;( const error_code &amp; lhs,
<span class="lineNum">     382 </span>            :                                     const error_code &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     383 </span>            :         //  the more symmetrical non-member syntax allows enum
<span class="lineNum">     384 </span>            :         //  conversions work for both rhs and lhs.
<span class="lineNum">     385 </span>            :       {
<span class="lineNum">     386 </span>            :         return lhs.m_cat &lt; rhs.m_cat
<span class="lineNum">     387 </span>            :           || (lhs.m_cat == rhs.m_cat &amp;&amp; lhs.m_val &lt; rhs.m_val);
<span class="lineNum">     388 </span>            :       }
<span class="lineNum">     389 </span>            : 
<span class="lineNum">     390 </span>            :     private:
<span class="lineNum">     391 </span>            :       int                     m_val;
<span class="lineNum">     392 </span>            :       const error_category *  m_cat;
<span class="lineNum">     393 </span>            : 
<span class="lineNum">     394 </span>            :     };
<span class="lineNum">     395 </span>            : 
<span class="lineNum">     396 </span>            :     //  predefined error_code object used as &quot;throw on error&quot; tag
<span class="lineNum">     397 </span>            : # ifndef BOOST_SYSTEM_NO_DEPRECATED
<span class="lineNum">     398 </span>            :     BOOST_SYSTEM_DECL extern error_code throws;
<span class="lineNum">     399 </span>            : # endif
<span class="lineNum">     400 </span>            : 
<span class="lineNum">     401 </span>            :     //  Moving from a &quot;throws&quot; object to a &quot;throws&quot; function without breaking
<span class="lineNum">     402 </span>            :     //  existing code is a bit of a problem. The workaround is to place the
<span class="lineNum">     403 </span>            :     //  &quot;throws&quot; function in namespace boost rather than namespace boost::system.
<span class="lineNum">     404 </span>            : 
<span class="lineNum">     405 </span>            :   }  // namespace system
<span class="lineNum">     406 </span>            : 
<span class="lineNum">     407 </span>            :   namespace detail { inline system::error_code * throws() { return 0; } }
<span class="lineNum">     408 </span>            :     //  Misuse of the error_code object is turned into a noisy failure by
<span class="lineNum">     409 </span>            :     //  poisoning the reference. This particular implementation doesn't
<span class="lineNum">     410 </span>            :     //  produce warnings or errors from popular compilers, is very efficient
<span class="lineNum">     411 </span>            :     //  (as determined by inspecting generated code), and does not suffer
<span class="lineNum">     412 </span>            :     //  from order of initialization problems. In practice, it also seems
<span class="lineNum">     413 </span>            :     //  cause user function error handling implementation errors to be detected
<span class="lineNum">     414 </span>            :     //  very early in the development cycle.
<span class="lineNum">     415 </span>            : 
<span class="lineNum">     416 </span>            :   inline system::error_code &amp; throws()
<span class="lineNum">     417 </span>            :     { return *detail::throws(); }
<span class="lineNum">     418 </span>            : 
<span class="lineNum">     419 </span>            :   namespace system
<span class="lineNum">     420 </span>            :   {
<span class="lineNum">     421 </span>            :     //  non-member functions  ------------------------------------------------//
<span class="lineNum">     422 </span>            : 
<span class="lineNum">     423 </span>            :     inline bool operator!=( const error_code &amp; lhs,
<span class="lineNum">     424 </span>            :                             const error_code &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     425 </span>            :     {
<span class="lineNum">     426 </span>            :       return !(lhs == rhs);
<span class="lineNum">     427 </span>            :     }
<span class="lineNum">     428 </span>            : 
<span class="lineNum">     429 </span>            :     inline bool operator!=( const error_condition &amp; lhs,
<span class="lineNum">     430 </span>            :                             const error_condition &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     431 </span>            :     {
<span class="lineNum">     432 </span>            :       return !(lhs == rhs);
<span class="lineNum">     433 </span>            :     }
<span class="lineNum">     434 </span>            : 
<span class="lineNum">     435 </span>            :     inline bool operator==( const error_code &amp; code,
<span class="lineNum">     436 </span>            :                             const error_condition &amp; condition ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     437 </span>            :     {
<span class="lineNum">     438 </span>            :       return code.category().equivalent( code.value(), condition )
<span class="lineNum">     439 </span>            :         || condition.category().equivalent( code, condition.value() );
<span class="lineNum">     440 </span>            :     }
<span class="lineNum">     441 </span>            : 
<span class="lineNum">     442 </span>            :     inline bool operator!=( const error_code &amp; lhs,
<span class="lineNum">     443 </span>            :                             const error_condition &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     444 </span>            :     {
<span class="lineNum">     445 </span>            :       return !(lhs == rhs);
<span class="lineNum">     446 </span>            :     }
<span class="lineNum">     447 </span>            : 
<span class="lineNum">     448 </span>            :     inline bool operator==( const error_condition &amp; condition,
<span class="lineNum">     449 </span>            :                             const error_code &amp; code ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     450 </span>            :     {
<span class="lineNum">     451 </span>            :       return condition.category().equivalent( code, condition.value() )
<span class="lineNum">     452 </span>            :         || code.category().equivalent( code.value(), condition );
<span class="lineNum">     453 </span>            :     }
<span class="lineNum">     454 </span>            : 
<span class="lineNum">     455 </span>            :     inline bool operator!=( const error_condition &amp; lhs,
<span class="lineNum">     456 </span>            :                             const error_code &amp; rhs ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     457 </span>            :     {
<span class="lineNum">     458 </span>            :       return !(lhs == rhs);
<span class="lineNum">     459 </span>            :     }
<span class="lineNum">     460 </span>            : 
<span class="lineNum">     461 </span>            :     // TODO: both of these may move elsewhere, but the LWG hasn't spoken yet.
<span class="lineNum">     462 </span>            : 
<span class="lineNum">     463 </span>            :     template &lt;class charT, class traits&gt;
<span class="lineNum">     464 </span>            :     inline std::basic_ostream&lt;charT,traits&gt;&amp;
<span class="lineNum">     465 </span>            :       operator&lt;&lt; (std::basic_ostream&lt;charT,traits&gt;&amp; os, error_code ec)
<span class="lineNum">     466 </span>            :     {
<span class="lineNum">     467 </span>            :       os &lt;&lt; ec.category().name() &lt;&lt; ':' &lt;&lt; ec.value();
<span class="lineNum">     468 </span>            :       return os;
<span class="lineNum">     469 </span>            :     }
<span class="lineNum">     470 </span>            : 
<span class="lineNum">     471 </span>            :     inline std::size_t hash_value( const error_code &amp; ec )
<span class="lineNum">     472 </span>            :     {
<span class="lineNum">     473 </span>            :       return static_cast&lt;std::size_t&gt;(ec.value())
<span class="lineNum">     474 </span>            :         + reinterpret_cast&lt;std::size_t&gt;(&amp;ec.category());
<span class="lineNum">     475 </span>            :     }
<span class="lineNum">     476 </span>            : 
<span class="lineNum">     477 </span>            :     //  make_* functions for errc::errc_t  -----------------------------//
<span class="lineNum">     478 </span>            : 
<span class="lineNum">     479 </span>            :     namespace errc
<span class="lineNum">     480 </span>            :     {
<span class="lineNum">     481 </span>            :       //  explicit conversion:
<span class="lineNum">     482 </span>            :       inline error_code make_error_code( errc_t e ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     483 </span>            :         { return error_code( e, generic_category() ); }
<span class="lineNum">     484 </span>            : 
<span class="lineNum">     485 </span>            :       //  implicit conversion:
<span class="lineNum">     486 </span>            :       inline error_condition make_error_condition( errc_t e ) BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     487 </span>            :         { return error_condition( e, generic_category() ); }
<span class="lineNum">     488 </span>            :     }
<span class="lineNum">     489 </span>            : 
<span class="lineNum">     490 </span>            :     //  error_category default implementation  -------------------------------//
<span class="lineNum">     491 </span>            : 
<span class="lineNum">     492 </span>            :     error_condition error_category::default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     493 </span>            :     {
<span class="lineNum">     494 </span>            :       return error_condition( ev, *this );
<span class="lineNum">     495 </span>            :     }
<span class="lineNum">     496 </span>            : 
<span class="lineNum">     497 </span>            :     bool error_category::equivalent( int code,
<span class="lineNum">     498 </span>            :       const error_condition &amp; condition ) const BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     499 </span>            :     {
<span class="lineNum">     500 </span>            :       return default_error_condition( code ) == condition;
<span class="lineNum">     501 </span>            :     }
<span class="lineNum">     502 </span>            : 
<span class="lineNum">     503 </span>            :     bool error_category::equivalent( const error_code &amp; code,
<span class="lineNum">     504 </span>            :       int condition ) const BOOST_SYSTEM_NOEXCEPT
<span class="lineNum">     505 </span>            :     {
<span class="lineNum">     506 </span>            :       return *this == code.category() &amp;&amp; code.value() == condition;
<span class="lineNum">     507 </span>            :     }
<span class="lineNum">     508 </span>            : 
<span class="lineNum">     509 </span>            :   } // namespace system
<span class="lineNum">     510 </span>            : } // namespace boost
<span class="lineNum">     511 </span>            : 
<span class="lineNum">     512 </span>            : #include &lt;boost/config/abi_suffix.hpp&gt; // pops abi_prefix.hpp pragmas
<span class="lineNum">     513 </span>            : 
<span class="lineNum">     514 </span>            : # ifdef BOOST_ERROR_CODE_HEADER_ONLY
<span class="lineNum">     515 </span>            : #   include &lt;boost/system/detail/error_code.ipp&gt;
<span class="lineNum">     516 </span>            : # endif
<span class="lineNum">     517 </span>            : 
<span class="lineNum">     518 </span>            : #endif // BOOST_ERROR_CODE_HPP
<span class="lineNum">     519 </span>            : 
<span class="lineNum">     520 </span>            : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
